import { _decorator, Component, Node, Sprite } from 'cc';
import { gameConfig } from '../data/gameConfig';
const { ccclass, property } = _decorator;

@ccclass('red')
export class red extends Component {
    @property(Sprite)
    redSprite: Sprite = null;
    position: number[] = [0, 0];
    start() {

    }

    init() {
        this.redSetPos();
    }
    update(deltaTime: number) {

    }
    redSetPos() {
        //坐标值*方块大小-游戏原点 设置左下角为[0,0]
        this.node.setPosition(this.position[0] * gameConfig.blockSize - gameConfig.gameOrigin[0], this.position[1] * gameConfig.blockSize - gameConfig.gameOrigin[1]);
    }
}


